
package com.zy.je.common.core.web.service;

import com.alibaba.fastjson2.JSON;
import com.zy.je.common.core.service.CommonService;
import com.zy.je.common.core.utils.lang.StackUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.core.text.StrUtil;
import org.springframework.stereotype.Service;

/**
 * @author zy
 */
@Slf4j
@Service
@RequiredArgsConstructor
public abstract class BaseServiceImpl implements CommonService {
    protected static void logDebug(String str, Object... param) {
        String callerMethodName = StrUtil.format("({})", StackUtil.getCallerMethodName(2));
        log.debug(callerMethodName + str, param);
    }
    protected static void logInfo(String str, Object... param) {
        String callerMethodName = StrUtil.format("({})", StackUtil.getCallerMethodName(2));
        log.info(callerMethodName + str, param);
    }
    protected static void logError(String str, Object... param) {
        String callerMethodName = StrUtil.format("({})", StackUtil.getCallerMethodName(2));
        log.error(callerMethodName + str, param);
    }

    protected static String toJsonStr(Object src) {
        try {
            return JSON.toJSONString(src);
        } catch (Exception var2) {
            log.error("转json处理出错:{}", src);
            return null;
        }
    }
}
